package com.zz.parkingsystem.controller.admin;

import com.zz.parkingsystem.dto.PageDTO;
import com.zz.parkingsystem.service.SystemRunningService;
import com.zz.parkingsystem.util.Result;
import com.zz.parkingsystem.util.ResultGenerator;
import com.zz.parkingsystem.vo.PageResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author wangyuxiang
 */
@RestController
@RequestMapping("/log")
@Api(tags = "管理员的操作日志")
public class AdminSystemRunningController {

    @Resource
    private SystemRunningService systemRunningService;

    @PostMapping("/queryAllSystemRunning")
    @ApiOperation(value = "查询所有操作日志")
    @ApiParam(name = "查询所有操作日志",value = "无参数")
    public Result queryAll(@RequestBody PageDTO pageDTO) {
        PageResult list = systemRunningService.queryAllSystemRunning(pageDTO);
        return ResultGenerator.genSuccessResult(list);
    }

    @DeleteMapping("/deleteSR/{id}")
    @ApiOperation(value = "删除一条操作日志")
    @ApiParam(name = "删除一条操作日志",value = "srId")
    public Result del(@PathVariable("id") Integer srId) {
        int i = systemRunningService.deleteByPrimaryKey(srId.longValue());
        return ResultGenerator.genSuccessResult();
    }

}
